package com.cn.learn.jpa.util;


import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;

/**
 * @ClassName DownloadUtil
 * @Description TODO
 * @Author JiJiang
 * @Date 2022/9/17 11:02
 * @Version 1.0
 */

public class DownloadUtil {

    private DownloadUtil(){

    }


    public static DownloadUtil Instance(){
        return DownloadUtilInnerClass.Instance;
    }


    private static class DownloadUtilInnerClass{
        public static DownloadUtil Instance = new DownloadUtil();
    }







    public  static  String getFileName(String agent,String filename) throws UnsupportedEncodingException {

        //region
       /** //IE浏览器
        if(agent.contains("MSIE")){
            filename = URLEncoder.encode(filename,"utf-8");
            filename = filename.replace("+"," ");

        }
        //火狐浏览器
        else if(agent.contains("Firefox")){
            BASE64Encoder base64Encoder = new BASE64Encoder();
            filename = "=?utf-8?B?"+base64Encoder.encode(filename.getBytes("utf-8"))+"?=";
        }
        //其他浏览器
        else{
            filename = URLEncoder.encode(filename,"utf-8");
        }
        return filename;
        **/
        //endergion
        return null;
    }
}